package com.imagination.applet.controller.web.configuration;

import lombok.Getter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;


@Getter
public class JwtToken extends AbstractAuthenticationToken {
    public static final String USER_ID = "userId";
    public static final String OPEN_ID = "openId";
    public static final String OPEN_ID_TYPE = "openIdType";
    public static final String ACCESS_KEY = "accessKey";

    private Long userId;
    private String openId;
    private String openIdType;
    private String accessKey;

    public JwtToken(Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
    }

    public JwtToken(Long userId, String openId, String openIdType, String accessKey) {
        super(null);
        this.userId = userId;
        this.openId = openId;
        this.openIdType = openIdType;
        this.accessKey = accessKey;
        super.setAuthenticated(true);
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return null;
    }
}
